import plotly.offline as pyo
from plotly.graph_objs import *
import chart_studio.plotly as py
import pandas as pd
from pandas import DataFrame
pyo.offline.init_notebook_mode()
outcomes = pd.read_csv(r"../Data/StudentOutcomes201415BySubjectArea.csv", index_col = 0)
outcomes
| Work | Work and further study | Further study | Unemployed | Other | |
|---|---|---|---|---|---|
| Medicine & dentistry | 6855.0 | 135.0 | 345.0 | 15.0 | 35.0 |
| Subjects allied to medicine | 22135.0 | 935.0 | 1825.0 | 620.0 | 630.0 |
| Biological sciences | 15725.0 | 1800.0 | 6045.0 | 1520.0 | 1335.0 |
| Veterinary science | 550.0 | 10.0 | 20.0 | 5.0 | 10.0 |
| Agriculture & related subjects | 1265.0 | 120.0 | 195.0 | 120.0 | 145.0 |
| Physical sciences | 6510.0 | 555.0 | 3410.0 | 920.0 | 620.0 |
| Mathematical sciences | 2910.0 | 360.0 | 1230.0 | 385.0 | 265.0 |
| Computer science | 7220.0 | 225.0 | 810.0 | 925.0 | 310.0 |
| Engineering & technology | 9420.0 | 405.0 | 1740.0 | 1010.0 | 580.0 |
| Architecture, building & planning | 3345.0 | 230.0 | 380.0 | 270.0 | 170.0 |
| Total - Science subject areas | 75930.0 | 4770.0 | 15995.0 | 5780.0 | 4110.0 |
| Social studies | 14925.0 | 1355.0 | 3795.0 | 1465.0 | 1380.0 |
| Law | 4470.0 | 995.0 | 2870.0 | 485.0 | 425.0 |
| Business & administrative studies | 20150.0 | 1500.0 | 2295.0 | 1790.0 | 1375.0 |
| Mass communications & documentation | 5210.0 | 165.0 | 455.0 | 520.0 | 355.0 |
| Languages | 9340.0 | 940.0 | 3165.0 | 975.0 | 870.0 |
| Historical & philosophical studies | 6140.0 | 715.0 | 2640.0 | 705.0 | 635.0 |
| Creative arts & design | 19925.0 | 920.0 | 2170.0 | 1865.0 | 1290.0 |
| Education | 9590.0 | 370.0 | 1485.0 | 285.0 | 400.0 |
| Combined | 245.0 | 40.0 | 80.0 | 25.0 | 35.0 |
| Total | 165930.0 | 11765.0 | 34950.0 | 13900.0 | 10875.0 |
fig = {'data' : [{'type' : 'pie',
'labels' : outcomes.columns.tolist(),
'values' : outcomes.loc['Medicine & dentistry'],
'name' : 'Medicine & dentistry',
'direction' : 'clockwise'}],
'layout' : {'title' : 'Outcomes for Medicine and Dentistry Students'}}
pyo.iplot(fig)
fig['data'][0].update({'hole' : 0.9})
pyo.iplot(fig)
fig['data'][0].update({'hole' : 0.5})
pyo.iplot(fig)
info = "Medicine & Dentistry students are more likely to be employed than students from any other subject area"
fig['layout'].update({'annotations' : [{'text' : info,
'xref' : 'paper',
'yref' : 'paper',
'x' : 0.5,
'y' : 0.5,
'showarrow' : False}]})
pyo.iplot(fig)
info = "<b>Medicine &<br>Dentistry students<br>are more likely to<br>be employed than<br>students from any<br>other subject<br>area</b>"
fig['layout'].update({'annotations' : [{'text' : info,
'xref' : 'paper',
'yref' : 'paper',
'x' : 0.5,
'y' : 0.5,
'showarrow' : False,
'font' : {'size' : 16}}]})
pyo.iplot(fig)
fig['data'][0].update({'hole' : 0.55})
pyo.iplot(fig)